/*
* @Author: mikey.zhaopeng
* @Date:   2016-06-04 16:32:26
* @Last Modified by:   mikey.zhaopeng
* @Last Modified time: 2016-07-13 16:16:01
*/

'use strict';

define([
    '../../../framework/base/baseView',
    'text!../tpl/adPreview/instagramstream.html'
], function(
    BaseView,
    tpl
) {
    function me() {
        BaseView.apply(this, arguments);
        var self = this;
        this.init = function($root, preivewImg) {
            self.$root = $root;
            self.$preivewImg = null;
            self.preivewImg = preivewImg;
            self.render();
        }

        this.render = function() {
            self.$root.html(I18N.parse(tpl,'createMaterial'));
            self.$preivewImg = self.$root.find('.preview-img');
            // 判断是否是轮播广告（CA,LA）,判断是否是大图片 (>600)
            //var imgWidth = window.localStorage.getItem("previewImg-width");
            //if(imgWidth > 500){
                //self.$preivewImg.css({left: "11px",top: "128px",
                //    width: "318px"
                //});
                //self.$preivewImg.attr('src','http://ec-image.clientgear.com/root/material_style/8/8.png');
            //}
            self.$preivewImg.attr('src',self.preivewImg);
            self.event();
        }

        this.event = function() {
            self.$root.find('.btn-next').off('click').on('click', $.proxy(self.submitStep1, self));
        }


        this.submitStep1 = function(e) {
            self.$root.trigger('enterStep2');
        }

    }
    return me;
});
